const express = require("express");
const router = express.Router();
const { registerUser } = require("../utils/sql");

// 注册
router.post("/register", async (req, res) => {
  let userObj = req.body;
  console.log(userObj);
  const result = await registerUser(userObj);
  if (result.affectedRows > 0) {
    res.send({ code: 200, msg: "注册成功" });
  } else {
    res.send({ code: 400, msg: "注册失败" });
  }
});

module.exports = router;
